<template>
	<input-table style="width:100%"
	             :readOnly="$props.readOnly"
	             v-model="table" @add="v=>{}">

        <template #header> <div  v-if="title" class="title">
            {{title}}
        </div> </template>
		<el-table-column align="center" label="枚举项">
			<template v-slot="scope">
				<el-input v-model="scope.row.key" chk="*"></el-input>
			</template>
		</el-table-column>
		<el-table-column align="center" label="备注">
			<template v-slot="scope">
				<el-input v-model="scope.row.value"></el-input>
			</template>
		</el-table-column>
	</input-table>

</template>

<script setup>
/**
 * Created by CodeGenerator at 2023-10-19 08:13:36
 */



defineOptions({
    name: "ref-table-key-value-string",
    inheritAttrs: true,
});

//定义 vue2的this,当前组件
const $self = getCurrentInstance();

//定义 $attrs
const $attrs = useAttrs();



//定义data
const $data = reactive({});


const $props = defineProps({
    title : { type: String },
    readOnly : { type: Boolean }
});


const $model = defineModel({ type: Array });



const list = ref();

//定义事件
const $emit = defineEmits(["update:modelValue","loaded"]);

const table = $computed({ get() {
        return $model;
    },set(v){
        var v = Object.assign(v.getJsType() == "array" ? [] : {}, v);
        $emit("update:modelValue", v);
    } });

const procData = function(res, op) {
    let json = res.data.data;
    json.forEach(it => {
//如果是组合实体，设置 it.id=...
    });
};

</script>

<style scoped lang="scss">
.title{
	margin-top:10px;
	&:after{
		content: "：";
		display: inline-block;
	}
}
</style>